<?php
session_start();
$snum = rand(100,99999);
$_SESSION['snum'] = $snum;
header("Content-type: image/jpeg");
$im = imagecreate(150, 40);
$bg = imagecolorallocate($im, 255, 255, mt_rand(204,255));
for ($i=0;$i<strlen($snum);$i++) {
  $txt = imagecolorallocate($im, mt_rand(0,127), mt_rand(0,127), mt_rand(0,127));
  $dis = substr($snum,$i,1);
  $x = ($i*30) + mt_rand(3,16);
  $y = mt_rand(3,26);
  imagestring($im, 5, $x, $y, $dis, $txt);
}
for ($i=1;$i<200;$i++) {
  if ($i == 10 || $i == 30 || $i == 50 || $i == 70 || $i == 90) {
    $txt = imagecolorallocate($im, mt_rand(0,127), mt_rand(0,127), mt_rand(0,127));
  }
  imagesetpixel($im,mt_rand(1,150),mt_rand(1,40),$txt);
}
imagejpeg($im);
imagedestroy($im);
?>